# compile options & flags
CROSS_COMPILE ?= 
CC = $(CROSS_COMPILE)gcc
CFLAGS = -g -Wall
INC = -I./

# define file name of source & output
SRCS_SERVER = rudp.c tests/server.c tests/comm.c
SRCS_CLIENT = rudp.c tests/client.c tests/comm.c
SRCS_RUDP = rudp.c tests/main.c

OUTPUT_SERVER = server
OUTPUT_CLIENT = client
OUTPUT_RUDP = rudp

# make cs = make client & server
.PHONY: cs
cs: $(OUTPUT_SERVER) $(OUTPUT_CLIENT) $(OUTPUT_RUDP)

# compile
$(OUTPUT_RUDP): $(SRCS_RUDP)
	$(CC) $(INC) $(CFLAGS) -o $@ $^

$(OUTPUT_SERVER): $(SRCS_SERVER)
	$(CC) $(INC) $(CFLAGS) -o $@ $^

$(OUTPUT_CLIENT): $(SRCS_CLIENT)
	$(CC) $(INC) $(CFLAGS) -o $@ $^

clean:
	rm -f $(OUTPUT_SERVER) $(OUTPUT_CLIENT) $(OUTPUT_RUDP)
